package router

import (
	"github.com/gin-gonic/gin"
	"kuangstudy-mall/apis/userrelation-web/api"
	middlewares "kuangstudy-mall/apis/userrelation-web/middleawares"
)

func InitOrderRouter(RouterGroup *gin.RouterGroup) {
	shopcartRouter := RouterGroup.Group("/user/fav").Use(middlewares.JWTAuth())
	{
		shopcartRouter.POST("/list", (&api.UserFavApi{}).FindFavDetail)
		shopcartRouter.POST("/save", (&api.UserFavApi{}).SaveUserFav)
		shopcartRouter.POST("/cancel", (&api.UserFavApi{}).CancelUserFav)
		shopcartRouter.POST("/get", (&api.UserFavApi{}).GetUserFavDetail)
	}

	orderRouter := RouterGroup.Group("/user/address").Use(middlewares.JWTAuth())
	{
		// 查询用户收货地址
		orderRouter.POST("/list", (&api.UserAddressApi{}).FindUserAddressList)
		// 创建收货地址
		orderRouter.POST("/create", (&api.UserAddressApi{}).CreateUserAddress)
		// 更新收货地址
		orderRouter.POST("/update", (&api.UserAddressApi{}).UpdateUserAddress)
		// 删除收货地址
		orderRouter.POST("/del", (&api.UserAddressApi{}).DeleteUserAddress)
		// 查询用户的收货地址
		orderRouter.POST("/default", (&api.UserAddressApi{}).GetUserAddressByDefault)
		// 设置用户默认收货地址
		orderRouter.POST("/setting/default", (&api.UserAddressApi{}).SettingUserAddressByDefault)
	}
}
